package com.wcs.exam.controller.auth.resp;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * Auth-考试-响应对象
 * </p>
 *
 * @author wcs
 * @since 2024-07-10
 */
@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "Auth-考试-作答解析-响应对象")
public class AuthExamParseResp implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "考试记录ID")
    private Long recordId;

    @Schema(description = "考试类型(1：模拟考试、2：正式考试)")
    private Integer examType;

    @Schema(description = "考试名称")
    private String examName;

    @Schema(description = "考试说明")
    private String description;

    @Schema(description = "作答时长(单位：分钟)")
    private Integer answerTime;

    @Schema(description = "人脸识别(false：关闭、true：开启)")
    private Boolean faceId;

    @Schema(description = "切屏限制(false：关闭、true：开启)")
    private Boolean switchScreenLimit;

    @Schema(description = "切屏限制次数")
    private Integer switchScreenCount;

    @Schema(description = "切屏判断时间(单位：秒)")
    private Integer switchScreenTime;

    @Schema(description = "题目数量")
    private Integer questionCount;

    /*-------------------------------------------------- 拓展内容 --------------------------------------------------*/

    @Schema(description = "用户名称")
    private String nickname;

    @Schema(description = "用户得分")
    private BigDecimal userScore;

    @Schema(description = "答卷剩余时间(单位：秒)")
    private Integer surplusTime;

    @Schema(description = "考试总分")
    private BigDecimal totalScore;

    @Schema(description = "及格分值")
    private BigDecimal passScore;

    @Schema(description = "合格状态(1:未知、2:合格、3:不及格)")
    private Integer passStatus;

    @Schema(description = "成绩显示(false：禁止、true：显示)")
    private Boolean resultShow;

    @Schema(description = "成绩展示规则(1：交卷后、2：考试结束后、3：自定义)-只能查看评阅完成的记录")
    private Integer resultShowRule;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Schema(description = "成绩展示时间")
    private LocalDateTime resultShowTime;

    @Schema(description = "作答内容展示(false：禁止、true：显示)-开启成绩显示才能开启")
    private Boolean answerShow;

    @Schema(description = "作答内容展示规则(1：查看对错和答案解析、2：只看对错)-只能查看评阅完成的记录")
    private Integer answerShowRule;

    @Schema(description = "结果显示名次(false：禁止、true：显示)-开启成绩显示才能开启")
    private Boolean resultShowRank;

    @Schema(description = "排行榜(false：禁止、true：显示)")
    private Boolean rankList;

    @Schema(description = "考试大题")
    private List<ExamTitle> titles;


    @Data
    @Schema(name = "ExamTitle", description = "Auth-考试-考试大题-响应对象")
    public static class ExamTitle implements Serializable {

        @Serial
        private static final long serialVersionUID = -4524614547022420664L;

        @Schema(description = "标题ID")
        private Long id;

        @Schema(description = "标题名称")
        private String titleName;

        @Schema(description = "标题分数")
        private BigDecimal titleScore;

        @Schema(description = "题目数量")
        private Integer questionCount;

        @Schema(description = "排序")
        private Integer sort;

        /*-------------------------------------------------- 拓展内容 --------------------------------------------------*/

        @Schema(description = "考试题目")
        private List<Question> questions;
    }

    @Data
    @Schema(name = "AuthExamParseResp.Question", description = "Auth-考试-题目信息-响应对象")
    public static class Question implements Serializable {

        @Serial
        private static final long serialVersionUID = -5365584824670825646L;

        @Schema(description = "父级ID")
        private Long parentId;

        @Schema(description = "试题ID")
        private Long questionId;

        @Schema(description = "题目类型(1:单选题、2:多选题、3:判断题、4:填空题、5:简答题)")
        private Integer questionType;

        @Schema(description = "题目分值")
        private BigDecimal questionScore;

        @Schema(description = "排序")
        private Integer sort;

        /*-------------------------------------------------- 拓展内容 --------------------------------------------------*/

        @Schema(description = "难度等级(1:简单、2:一般、3:困难)")
        private Integer difficultyLevel;

        @Schema(description = "题目内容")
        private String questionTitle;

        @Schema(description = "题目答案")
        private String questionAnswer;

        @Schema(description = "题目解析")
        private String questionAnalysis;

        @Schema(description = "填空数")
        private Integer optionCount;

        @Schema(description = "题目选项")
        private List<QuestionOption> options;

        @Schema(description = "题目答案ID")
        private List<Long> questionAnswerIds;

        @Schema(description = "用户答案")
        private String userAnswer;

        @Schema(description = "用户得分")
        private BigDecimal userScore;

        @Schema(description = "用户答题状态(1:错误、2:正确、3:待批改)")
        private Integer userAnswerStatus;

        @Schema(description = "评语")
        private String evaluationComment;

        @Schema(description = "评阅完成(false:未完成、true:已完成)")
        private Boolean evaluationComplete;

    }

    @Data
    @Schema(name = "AuthExamParseResp.QuestionOption", description = "Auth-考试-题目选项-响应对象")
    public static class QuestionOption implements Serializable {

        @Serial
        private static final long serialVersionUID = -8108339466857778998L;

        @Schema(description = "主键ID")
        private Long id;

        @Schema(description = "题目ID")
        private Long questionId;

        @Schema(description = "选项内容")
        private String optionContent;

        @Schema(description = "排序")
        private Integer sort;
    }
}
